#ifndef CLIENT_H
#define CLIENT_H

#include <QObject>
#include "httpclient.h"

class Client : public QObject
{
    Q_OBJECT
public:
    Client(QString email, QString password);
    ~Client();
    void setAuthInfo(QString email, QString password);
    void setConnectionInfo(QString host, int port);
    void setProxyInfo(bool useProxy, QString proxyHost, int proxyPort,
                      bool useProxyAuth, QString proxyUser, QString proxyPass);
    void login();
    void check();
private:
    QString m_email;
    QString m_password;
    HttpClient *m_http;
    // State:
    bool logging;
    bool checking;
    bool logged;
    bool needCheck;
public slots:
    void httpRequestDone(QByteArray *data);
    void httpRequestError(QString message);
signals:
    void error(QString message);
    void messagesCount(int count);
};

#endif // CLIENT_H
